import { config } from '../../config/index';
import { request } from '../../utils/request';

/* 获取分类 */
function mockFetchClassification() {
  const { delay } = require('../_utils/delay');
  const { genClassification } = require('../../model/classification');

  return delay().then(() => genClassification());
}

export function fetchClassification() {
  if (config.useMock) {
    return mockFetchClassification();
  }

  return request('groups/selector').then((res) => {
    return res;
  });
}